//package com.zzyl.nursing.controller;
//import com.zzyl.common.utils.PDFUtil;
//import com.zzyl.common.utils.file.FileUtils;
//import com.zzyl.oss.client.OSSAliyunFileStorageService;
//import io.swagger.v3.oas.annotations.Operation;
//import io.swagger.v3.oas.annotations.Parameter;
//import io.swagger.v3.oas.annotations.tags.Tag;
//
//import java.io.InputStream;
//import java.util.List;
//import java.util.UUID;
//
//import jakarta.servlet.http.HttpServletResponse;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.security.access.prepost.PreAuthorize;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.PutMapping;
//import org.springframework.web.bind.annotation.DeleteMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import com.zzyl.common.annotation.Log;
//import com.zzyl.common.core.controller.BaseController;
//import com.zzyl.common.core.domain.AjaxResult;
//import com.zzyl.common.enums.BusinessType;
//import com.zzyl.nursing.domain.HealthAssessment;
//import com.zzyl.nursing.service.IHealthAssessmentService;
//import com.zzyl.common.utils.poi.ExcelUtil;
//import com.zzyl.common.core.page.TableDataInfo;
//import org.springframework.web.multipart.MultipartFile;
//
///**
// * 健康评估Controller
// *
// * @author sumjane
// * @date 2025-07-29
// */
//@Tag(name = "健康评估")
//@RestController
//@RequestMapping("/nursing/healthAssessment")
//public class HealthAssessmentController extends BaseController
//{
//
//    @Autowired
//    private IHealthAssessmentService healthAssessmentService;
//
//    @Autowired
//    private OSSAliyunFileStorageService ossAliyunFileStorageService;
//    @Autowired
//    private RedisTemplate<String,String> redisTemplate;
//
//    /**
//     * 通用上传请求（单个）
//     */
//    @PostMapping("/upload")
//    public AjaxResult uploadFile(MultipartFile file,String idCardNo) throws Exception
//    {
//        try {
//            String originalFilename = file.getOriginalFilename();
//            String fileExt = originalFilename.substring(originalFilename.lastIndexOf("."));
//            String fileName = UUID.randomUUID().toString()+fileExt;
//            String url = ossAliyunFileStorageService.store(fileName, file.getInputStream());
//
//            //1、提取PDF的内容
//            String content = PDFUtil.pdfToString(file.getInputStream());
//            //2、将内容存储到redis
//            redisTemplate.opsForValue().set(idCardNo,content);
//
//            AjaxResult ajax = AjaxResult.success();
//            ajax.put("url", url);  //文件访问路径
//            ajax.put("fileName", url);  //文件名字
//            ajax.put("newFileName", FileUtils.getName(fileName));
//            ajax.put("originalFilename", file.getOriginalFilename());
//            return ajax;
//        }
//        catch (Exception e)
//        {
//            return AjaxResult.error(e.getMessage());
//        }
//    }
//
//    /**
//     * 查询健康评估列表
//     */
//    @Operation(summary = "查询健康评估列表")
//    @PreAuthorize("@ss.hasPermi('nursing:healthAssessment:list')")
//    @GetMapping("/list")
//    public TableDataInfo list(HealthAssessment healthAssessment)
//    {
//        startPage();
//        List<HealthAssessment> list = healthAssessmentService.selectHealthAssessmentList(healthAssessment);
//        return getDataTable(list);
//    }
//
//    /**
//     * 导出健康评估列表
//     */
//    @Operation(summary = "导出健康评估列表")
//    @PreAuthorize("@ss.hasPermi('nursing:healthAssessment:export')")
//    @Log(title = "健康评估", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    public void export(HttpServletResponse response, HealthAssessment healthAssessment)
//    {
//        List<HealthAssessment> list = healthAssessmentService.selectHealthAssessmentList(healthAssessment);
//        ExcelUtil<HealthAssessment> util = new ExcelUtil<HealthAssessment>(HealthAssessment.class);
//        util.exportExcel(response, list, "健康评估数据");
//    }
//
//    /**
//     * 获取健康评估详细信息
//     */
//    @Operation(summary = "获取健康评估详细信息")
//    @PreAuthorize("@ss.hasPermi('nursing:healthAssessment:query')")
//    @GetMapping(value = "/{id}")
//    public AjaxResult getInfo(@Parameter(description ="健康评估ID") @PathVariable("id") Long id)
//    {
//        return success(healthAssessmentService.selectHealthAssessmentById(id));
//    }
//
//    /**
//     * 新增健康评估
//     */
//    @Operation(summary = "新增健康评估")
//    @PreAuthorize("@ss.hasPermi('nursing:healthAssessment:add')")
//    @Log(title = "健康评估", businessType = BusinessType.INSERT)
//    @PostMapping
//    public AjaxResult add(@RequestBody HealthAssessment healthAssessment)
//    {
//        return toAjax(healthAssessmentService.insertHealthAssessment(healthAssessment));
//    }
//
//    /**
//     * 修改健康评估
//     */
//    @Operation(summary = "修改健康评估")
//    @PreAuthorize("@ss.hasPermi('nursing:healthAssessment:edit')")
//    @Log(title = "健康评估", businessType = BusinessType.UPDATE)
//    @PutMapping
//    public AjaxResult edit(@RequestBody HealthAssessment healthAssessment)
//    {
//        return toAjax(healthAssessmentService.updateHealthAssessment(healthAssessment));
//    }
//
//    /**
//     * 删除健康评估
//     */
//    @Operation(summary = "删除健康评估")
//    @PreAuthorize("@ss.hasPermi('nursing:healthAssessment:remove')")
//    @Log(title = "健康评估", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{ids}")
//    public AjaxResult remove(@Parameter(description = "健康评估ID集合") @PathVariable Long[] ids)
//    {
//        return toAjax(healthAssessmentService.deleteHealthAssessmentByIds(ids));
//    }
//}
